FROM centos
MAINTAINER Wenxin "wenxindemail@163.com"
ENV REFRESHED_AT 2018-06-01

RUN yum update -y

# 使用阿里源
# RUN mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
# RUN curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# RUN yum makecache

# 更新yum
RUN yum install epel-release -y
RUN yum update -y
RUN yum install wget -y

# 安装mysql源
RUN wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
RUN yum localinstall mysql57-community-release-el7-11.noarch.rpm -y
RUN rm -f mysql57-community-release-el7-11.noarch.rpm

RUN yum update -y

# 导入公钥文件
# RUN rpm --import `ls /etc/pki/rpm-gpg`
# RUN yum update -y

# 安装php php-mysql httpd mysql
RUN yum install httpd php php-mysql -y --nogpgcheck
RUN yum install mysql-community-server -y --nogpgcheck

RUN touch /var/log/httpd/access_log

# 在镜像构建时初始化，mysql一直不成功
# RUN mysqld --initialize-insecure --user=root
# RUN chown -R root:root /var/lib/mysql*

EXPOSE 80
EXPOSE 3306

ADD start.sh /usr/bin/start.sh
RUN chmod a+x /usr/bin/start.sh

CMD /usr/bin/start.sh